/**
 * @file set_area_param.hpp
 * @author fwy (2643660853@qq.com)
 * @brief 
 * @version 0.1
 * @date 2025-03-28
 * 
 * @copyright Copyright (c) 2025
 * 
 */
#pragma once
#include <rclcpp/rclcpp.hpp>
#include "rclcpp_components/register_node_macro.hpp"
#include <fishbot_behavior_tree/async_behavior_base.hpp>
#include <behaviortree_cpp/action_node.h>
#include <fishbot_behavior_tree/check_error.hpp>
#include <std_msgs/msg/int16.hpp>


 
namespace fishbot::behaviors
{
    class SetAreaParam : public fishbot::behavior_tree::AsyncBehaviorBase
    {
    public:
    SetAreaParam(const std::string &name, const BT::NodeConfiguration &config,
                       const std::shared_ptr<fishbot::behavior_tree::BehaviorContext> &shared_resources);

        static BT::PortsList providedPorts();

    private: /*  */
        tl::expected<bool, std::string> doWork() override;

        std::shared_future<tl::expected<bool, std::string>> &getFuture() override
        {
            return future_;
        }
        
        void topicCallBack(const std_msgs::msg::Int16::SharedPtr msg);

        std::shared_future<tl::expected<bool, std::string>> future_;

        rclcpp::AsyncParametersClient::SharedPtr parameters_client_;

        rclcpp::Subscription<std_msgs::msg::Int16>::SharedPtr gray_state_sub_;
    };

}